package  as3.component.controls
{
	//import Guide.ArrowHint.Editor.EditorLayer;
	
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	public class DragWindow extends Canvas
	{
	
		public function DragWindow()
		{
			super();
			this.width=400;
			this.height=300;
			this.addEventListener(MouseEvent.MOUSE_DOWN,mouseDown);
			this.addEventListener(MouseEvent.MOUSE_UP,mouseUp);
		}
			
		public var dragHeight : int = 40;
		
		public function mouseDown(event : MouseEvent):void
		{
			frontMyself(this.parent);
			if(mouseY <= dragHeight)
			{
				var r : Rectangle = this.parent.getRect( this.parent ) ;
				this.startDrag(false, new Rectangle(0, 0, this.parent.parent.width - this.width , this.parent.parent.height - this.height));
			}
		}
		
		public function mouseUp(event : MouseEvent):void
		{
			this.stopDrag();
		}
		
		private function frontMyself(container : Object):void
		{
			container.setChildIndex(this,container.numChildren - 1);
		}
		
		override protected function initUI():void
		{
			super.initUI();
			_uiLibrary["bg"] = "Border4Skin";
		}
	}
}
